package com.torry.edss.domain.valueobject;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;

/**
 * @author torry
 */
@AllArgsConstructor
@Getter
public enum Bourse {
    /**
     *
     */
    SH("sh", "上交所"),
    SZ("sz", "深交所"),
    BJ("bj", "北交所"),
    HK("hk", "港交所"),
    ;

    private String code;
    private String decr;

    public static Bourse parse(String code) {
        return StringUtils.isBlank(code) ? null : Arrays.stream(Bourse.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }
}
